• Check command node_status is used to check status of Kubernetes Nodes. Returns OK if a node is Ready, otherwise, returns CRITICAL.
• Spec - node_status check command has no variables. Execution of this command can result in following states:
-> OK
-> CRITICAL
-> UNKNOWN

# Tutorial
• you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster.

kubectl create namespace demo

kubectl get namespaces
NAME          STATUS    AGE
default       Active    6h
kube-public   Active    6h
kube-system   Active    6h
demo          Active    4m

# Check status of all nodes
•  we are going to create a NodeAlert to check status of all nodes.

cat ./docs/examples/node-alerts/node_status/demo-0.yaml

apiVersion: monitoring.appscode.com/v1alpha1
kind: NodeAlert
metadata:
  name: node-status-demo-0
  namespace: demo
spec:
  check: node_status
  checkInterval: 30s
  alertInterval: 2m
  notifierSecretName: notifier-config
  receivers:
  - notifier: Mailgun
    state: CRITICAL
    to: ["ops@example.com"]
    
kubectl apply -f ./docs/examples/node-alerts/node_status/demo-0.yaml

kubectl describe nodealert -n demo node-status-demo-0

# Check status of nodes with matching labels
• If a NodeAlert will be used check status of nodes with matching labels by setting spec.selector field.

cat ./docs/examples/node-alerts/node_status/demo-1.yaml

apiVersion: monitoring.appscode.com/v1alpha1
kind: NodeAlert
metadata:
  name: node-status-demo-1
  namespace: demo
spec:
  check: node_status
  selector:
    beta.kubernetes.io/os: linux
  checkInterval: 30s
  alertInterval: 2m
  notifierSecretName: notifier-config
  receivers:
  - notifier: Mailgun
    state: CRITICAL
    to: ["ops@example.com"]
    
kubectl apply -f ./docs/examples/node-alerts/node_status/demo-1.yaml

kubectl describe nodealert -n demo node-status-demo-1

# Check status of a specific node
• If a NodeAlert will be used check status of a node by name by setting spec.nodeName field.

cat ./docs/examples/node-alerts/node_status/demo-2.yaml

apiVersion: monitoring.appscode.com/v1alpha1
kind: NodeAlert
metadata:
  name: node-status-demo-2
  namespace: demo
spec:
  check: node_status
  nodeName: minikube
  checkInterval: 30s
  alertInterval: 2m
  notifierSecretName: notifier-config
  receivers:
  - notifier: Mailgun
    state: CRITICAL
    to: ["ops@example.com"]
    
kubectl apply -f ./docs/examples/node-alerts/node_status/demo-2.yaml

kubectl describe nodealert -n demo node-status-demo-2

# Cleaning up
• To cleanup the Kubernetes resources

kubectl delete ns demo

# Link:- https://appscode.com/products/searchlight/5.1.1/guides/node-alerts/node_status/